﻿<Window x:Class="UnitCombobox.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:unit="clr-namespace:UnitComboLib;assembly=UnitComboLib"

        Title="MainWindow" Height="150" Width="225"
        
        xmlns:vm="clr-namespace:UnitCombobox.ViewModel"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 

        mc:Ignorable="d" 
        d:DesignHeight="200" d:DesignWidth="300"
        d:DataContext="{d:DesignInstance Type=vm:AppViewModel, IsDesignTimeCreatable=True}">
    <Grid Margin="3">
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="30" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="*" />
      <ColumnDefinition Width="Auto" />
    </Grid.ColumnDefinitions>

    <unit:UnitCombobox DataContext="{Binding SizeUnitLabel}"
                       Margin="1"
                       Padding="0"
                       BorderThickness="1"
                       BorderBrush="Transparent"
                       ItemsSource="{Binding SelectedItem.DefaultValues}"
                       ToolTip="{Binding ValueTip}"
                       IsEditable="True"
                       HorizontalAlignment="Stretch" VerticalAlignment="Top"
                       Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">
        <unit:UnitCombobox.Text>
        <Binding Path="StringValue" Mode="TwoWay" ValidatesOnDataErrors="True">
          <Binding.ValidationRules>
            <ExceptionValidationRule />
          </Binding.ValidationRules>
        </Binding>

      </unit:UnitCombobox.Text>
     </unit:UnitCombobox>

    <Separator Grid.Row="1" VerticalAlignment="Center" Grid.Column="0" Grid.ColumnSpan="3" />

    <Label Content="Check value:" Grid.Row="2" Grid.Column="0" />
    <Label Content="{Binding SizeUnitLabel.ScreenPoints}"
           HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="1" />
    <Label Content="points (pt)" Grid.Row="2" Grid.Column="2" />
  </Grid>
</Window>
